// Learn cc.Class:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
//  - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
// Learn Attribute:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
//  - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
// Learn life-cycle callbacks:
//  - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
//  - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html

import LanguageMngTs from "../Managers/LanguageMngTs";

cc.Class({
    extends: cc.Component,

    properties: {
        labelValue:{
            default:null,
            type:cc.Label
        },

        labelTitle:{
            default:null,
            type:cc.Label
        },

        gotIcon:{
            default:null,
            type:cc.Node,
        },

        tagCanCollect:{
            default:null,
            type:cc.Node,
        },

        _bonusMgr:null,
        _isDead : false,
    },

    // LIFE-CYCLE CALLBACKS:

    // onLoad () {},

    start () {

    },

    // update (dt) {},

    initDailyBonusItem:function (bonusMgr,data,dead,isNextCollected) {
        this._bonusMgr = bonusMgr
        this._isDead = dead
        this.isNextCollected = isNextCollected
        let day = data.day
        let coin = data.coin
        this.coin = coin
        this.labelTitle.string = LanguageMngTs.getSentence(325)+day //"Day"
        let value = cc.gg.gameDataUtil.showRupee ? "!"+cc.gg.gameDataUtil.getStringOfRupeeWithoutSymbol(coin) : coin
        this.labelValue.string = value
        if(dead){
            this.gotIcon.active = true
        }else {
            this.gotIcon.active = false
        }

        if(isNextCollected){
            this.tagCanCollect.active = true
        }else {
            this.tagCanCollect.active = false
        }
    }
});
